package com.extrace.server.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.extrace.server.pojo.Transpackage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 23735
 * Date: 2024-04-25
 * Time: 9:16
 */
public interface TranspackageMapper extends BaseMapper<Transpackage> {

    @Select("SELECT *\n" +
            "FROM transpackage\n" +
            "WHERE id= (\n" +
            "    SELECT pid FROM (\n" +
            "        SELECT id, pid FROM transpackagecontent\n" +
            "        WHERE eid=#{eid}\n" +
            "        ORDER BY id DESC\n" +
            "        LIMIT 1\n" +
            "    ) AS subquery\n" +
            ");")
    Transpackage getLastedTranspackageByEid(@Param("eid") String eid);
}
